package com.yangle.frame.bizlogic.service;

import com.yangle.frame.bizlogic.entity.Article;
import com.yangle.frame.bizlogic.mapper.ArticleMapper;
import com.yangle.frame.common.service.BaseService;
import com.yangle.frame.common.utils.MapperUtils;
import org.apache.ibatis.annotations.Update;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.util.Arrays;
import java.util.List;

/**
* Created by yangle on 2018/5/27.
*/
@Service
public class ArticleService implements BaseService<Article> {
@Autowired
private ArticleMapper articleMapper;

public List<Article> getAll(Article article) {
Example example = MapperUtils.getExampleByClass(Article.class, article);
return articleMapper.selectByExample(example);
}

public void create(Article article) {
articleMapper.insert(article);
}

public void update(Article article) {
articleMapper.updateByPrimaryKey(article);
}

public Article select(String id) {
return articleMapper.selectByPrimaryKey(id);
}

public void delete(String ids) {
articleMapper.deletes(Arrays.asList(ids.split(",")));
}
    //清除所有制定标记除自身
public    void updateAllZD(String id){
    articleMapper.updateAllZD(id);
}}
